#ifndef __SUBSYSTEM_DOOR_BLOCK_BEHAVIOR_H__
#define __SUBSYSTEM_DOOR_BLOCK_BEHAVIOR_H__

#include "Subsystems/BlockBehaviors/SubsystemBlockBehavior.hpp"
#include "Engine/Point3.hpp"

using namespace PocketSurvival::Engine;

namespace PocketSurvival
{
    class SubsystemTerrain;
    class BlocksManager;

    class SubsystemDoorBlockBehavior : public SubsystemBlockBehavior
    {
    protected:
        SubsystemTerrain *m_terrain;

    public:
        SubsystemDoorBlockBehavior();
        
        virtual void onBlockAdded(int32_t value, int32_t oldValue, int32_t x, int32_t y, int32_t z) override;
		virtual void onBlockRemoved(int32_t value, int32_t oldValue, int32_t x, int32_t y, int32_t z) override;
        virtual bool onInteract(const TerrainRaycastResult &raycastResult, ComponentMiner *componentMiner) override;
        virtual void onNeighborBlockChanged(int32_t x, int32_t y, int32_t z, int32_t neighborX, int32_t neighborY, int32_t neighborZ) override;
        bool openCloseDoor(int32_t x, int32_t y, int32_t z, bool open);

        virtual const std::string& getName() const override;
        virtual void update(float dt) override;
        virtual void load(const nlohmann::json& json) override;
        virtual void save(nlohmann::json& json) override;
        virtual void saveToMsgJson(nlohmann::json &jsonData) override;
    };
}

#endif